#!/usr/bin/python
# -*- coding: UTF-8 -*-

import datetime
import oss2

access_key_id = 'lllllllllhhhhhh'
access_key_secret = 'kkkkkkkkkkkkyyyyyyyyy'
bucket_name = 'switch'
endpoint = 'oss-cn-beijing.aliyuncs.com'
username = 'switch@1912537796081234.onaliyun.com'

def uploadFile(fileName,fileContent):
    # 日期做文件夹
    dateFolder = datetime.datetime.now().strftime("%Y%m%d")

    auth = oss2.Auth(access_key_id, access_key_secret)
    bucket = oss2.Bucket(auth, endpoint, bucket_name, connect_timeout=30)

    result = bucket.put_object(dateFolder + '/' + fileName, fileContent)
    print (result)


